home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / system / 4utils84.zip / fix.pas < prev    next >
Pascal/Delphi Source File  |  1994-10-08  |  2KB  |  128 lines

  1. { This unit prevents TV from Resetting the screen mode at start up
  2.   thus allowing to work with resolutions like 100x40
  3.  
  4.  
  5.  
  6.  
  7.        __                   Robert Juhasz  | University of Paderborn
  8.         \_\                  Ludwigstr. 16 | Department of Maths & CS
  9.           __                4790 Paderborn | Fachbereich 17
  10.     _____ \ \                      Germany |
  11.    / /___)_\ \                             |
  12.   /_/ \_\ \___)   robertj@uni-paderborn.de |}
  13.  
  14.  
  15. unit Fix;
  16. interface
  17.  
  18. uses dos;
  19.  
  20. procedure InitFix;
  21. procedure DoneFix;
  22.  
  23. implementation
  24.  
  25. var
  26.   OldInt10,
  27.   OldExit  : Pointer;
  28.   VMode    : Byte absolute $0:$449;   { BIOS video mode }
  29.  
  30. const
  31.   Installed: Boolean = false;
  32.  
  33. procedure ChainInt(OldInt:Pointer);
  34. inline($5b/$58/
  35.        $89/$ec/
  36.        $87/$46/$10/
  37.        $87/$5e/$0e/
  38.        $5d/$07/$1f/
  39.        $5f/$5e/$5a/$59/
  40.        $cb);
  41.  
  42. procedure FixMode(ax,bx,cx,dx,si,di,ds,es,bp:Word);Interrupt;
  43. begin
  44.   if Hi(ax)=0 then ax:=Word( VMode );
  45.   ChainInt(OldInt10)
  46. end;
  47.  
  48. procedure InitFix;
  49. begin
  50.   if not Installed
  51.   then begin
  52.     Installed := true;
  53.     GetIntVec($10,OldInt10);
  54.     SetIntVec($10,@FixMode)
  55.   end
  56. end;
  57.  
  58. procedure DoneFix;
  59. begin
  60.   if Installed
  61.   then begin
  62.     Installed := false;
  63.     SetIntVec($10,OldInt10)
  64.   end
  65. end;
  66.  
  67. procedure AtExit; far;
  68. begin
  69.   ExitProc := OldExit;
  70.   DoneFix;
  71. end;
  72.  
  73. begin
  74.   OldExit  := ExitProc;
  75.   ExitProc := @AtExit;
  76.   InitFix;
  77. end.
  78.  
  79.  
  80.  
  81. {   Use it like the next demo:
  82.  
  83.  
  84. {USEFIX.PAS}
  85. program USEFIX;
  86. uses
  87.   Dos, Objects, App, Fix;
  88. var
  89.   MyApp: TApplication;
  90.  
  91. (*
  92.  *  GetArgs: Commando-Zeile.
  93.  *)
  94.  
  95. function GetArgs: PString;
  96. const
  97.   S: String = '';
  98. begin
  99.   S := String( Ptr(PrefixSeg,$80)^ );  { lieber kopieren }
  100.   GetArgs := @S;
  101. end;
  102.  
  103. begin
  104.   InitFix;          { Fix ist nur wdhrend der }
  105.    MyApp.Init;      { Initialisierung aktiv!  }
  106.   DoneFix;
  107.   MyApp.Run;
  108.   MyApp.Done;
  109.  
  110. (*
  111.   {Alternativ:}
  112.   if (GetEnv('FIX')<>'') or
  113.      ( Pos('/F', GetArgs^)<>0 ) or
  114.      ( Pos('/f', GetArgs^)<>0 )
  115.   then
  116.     InitFix;
  117.   MyApp.Init;
  118.   DoneFix;
  119.  
  120.   MyApp.Run;
  121.   MyApp.Done;
  122. *)
  123. end.
  124. }
  125.  
  126.  
  127.  
  128.